/**
 *------------------------------------------------------------------------------
 *  @copyright Copyright (c) 2022  <dx_65535@163.com>. 
 * 
 *  @file       : data_protocol_factory.cc
 *  @author     : Xiang.D (dx_65535@163.com)
 *  @version    : 1.0
 *  @brief      : Blog: https://linuxtaoist.gitee.io
 *  @date       : 2022-06-04
 * 
 * 
 *  Change History:
 *  <Date>     | <Version> | <Author>       | <Description>
 *------------------------------------------------------------------------------
 *  2022/06/04 | 1.0.0.1   | Xiang.D        | Create file
 *------------------------------------------------------------------------------
 * 
 */

#include <stdio.h>
#include "data_protocol_factory.h"
#include "uart_parse.h"
#include "mq_parse.h"

#define LOGE(fmt, args...)  printf("%d TaskSchedule E: " fmt, __LINE__, ##args)

#ifdef TEST_DEBUG
#define LOGD(fmt, args...)  printf("%d TaskSchedule D: " fmt, __LINE__, ##args)
#else
#define LOGD(fmt, args...)
#endif

CDataProtocolFactory::CDataProtocolFactory()
{
    mpDataParse = nullptr;
}

CDataProtocolFactory::~CDataProtocolFactory()
{

}

CDataParse* CDataProtocolFactory::GetChannelParse(ETransChannel channel)
{
    switch (channel)
    {
        case CHANNEL_UART:
            mpDataParse = CUartParse::GetInstance();
        break;

        case CHANNEL_MQ:
            mpDataParse = CMqParse::GetInstance();
        break;

        default:
            LOGE("No this channel [%d]\n", channel);
        break;
    }

    return mpDataParse;
}



